package com.zhangzhan.gulimallproduct.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhangzhan.gulimallcommcon.exception.valid.AddGroup;
import com.zhangzhan.gulimallcommcon.exception.valid.UpdateGroup;
import com.zhangzhan.gulimallcommcon.exception.valid.UpdateStatus;
import com.zhangzhan.gulimallcommcon.validator.validinterface.product.myinterface.BrandShowStatusValid;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.io.Serializable;

/**
 * 品牌
 *
 * @author zhangzhan
 * @email sunlightcs@gmail.com
 * @date 2024-06-12 16:45:44
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @NotNull(message = "品牌id不能为空", groups = {UpdateGroup.class,UpdateStatus.class})
    @Null(message = "品牌id必须为空", groups = {AddGroup.class})
    private Long brandId;
    /**
     * 品牌名
     */
    @NotEmpty(message = "品牌名不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(message = "品牌名不能为空", groups = {AddGroup.class,UpdateGroup.class})
    @URL(message = "品牌logo地址必须是一个有效的URL地址", groups = {AddGroup.class, UpdateGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @BrandShowStatusValid(value = {0,1},groups = {AddGroup.class,UpdateGroup.class, UpdateStatus.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotNull(message = "检索首字母字段不能为空",groups = {AddGroup.class,UpdateGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$", message = "首字母必须在a-z或A-Z之间", groups = {AddGroup.class, UpdateGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序字段不能为空",groups = {AddGroup.class,UpdateGroup.class})
    @Min(value = 0, message = "排序最小不能小于0", groups = {AddGroup.class, UpdateGroup.class})
    private Integer sort;

}
